package com.testdemo.web.shapecalc.impl;

public class RectangleQuestionImpl extends ShapeQuestionImpl {
	int Length;
	int Width;
	
	public RectangleQuestionImpl(){
		Length = Math.abs((int)(Math.random()*10 + 1));
		Width = Math.abs((int)(Math.random()*10 + 4));
		 
		CalcArea();
		CalcPerimeter();		
	}
	
	public RectangleQuestionImpl(int l, int w){
		Length = l;
		Width = w;
		CalcArea();
		CalcPerimeter();		
	}
	
	@Override
	public void CalcArea()
	{
		Area = Length * Width;		
	}
	
	@Override
	public void CalcPerimeter()
	{
		Perimeter = 2 * (Length + Width);
	}

	@Override
	public String getQusitionString() {
		// TODO Auto-generated method stub
		String temp;
		temp = "题目：一个为长方形，其长为 " + Integer.toString(Length) + "宽为" + 
				Integer.toString(Width)+ ", 请计算该正方形的面积和周长。";
		return temp;
	}

}
